import express from 'express'
import payController from '@/controllers/payController'
import userAuth from '@/middlewares/user-auth'

const router = express.Router()

/**
 * 生成支付链接
 * POST /pay
 */
router.post('/', userAuth, payController.generatePay)

/**
 * 同步通知
 * GET /pay/finish
 */
router.get('/finish', payController.finishSync)

/**
 * 异步通知
 * GET /pay/notify
 */
router.get('/notify', payController.notifyAsync)

/**
 * 主动查询ezf订单状态
 * GET /pay/query
 */
router.get('/query', userAuth, payController.queryPayOrder)

/**
 * 主动更新ezf订单状态
 * GET /pay/update
 */
router.get('/update', userAuth, payController.updatePayOrder)

export default router
